
package com.yimixian.app.adapter;

import com.baidu.mapapi.search.core.PoiInfo;
import com.yimixian.app.R;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class PoiListViewAdapter extends ArrayListAdapter<PoiInfo> {
    public PoiListViewAdapter(Activity context) {
        super(context);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            convertView = LayoutInflater.from(mContext).inflate(R.layout.poi_list_view_item,
                    parent, false);
        }
        PoiInfo poiInfo = mList.get(position);
        ((TextView) ((ViewGroup) convertView).getChildAt(0)).setText(poiInfo.name);
        ((TextView) ((ViewGroup) convertView).getChildAt(1)).setText(poiInfo.address);
        return convertView;
    }

    @Override
    public boolean hasStableIds() {
        return true;
    }
}
